home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
EnigmA Amiga Run 1995 November
/
EnigmA AMIGA RUN 02 (1995)(G.R. Edizioni)(IT)[!][issue 1995-11][Skylink CD].iso
/
earcd
/
util
/
text
/
cedispel.lha
/
CEDispell
/
Spell.ced
next >
Wrap
Text File
|
1995-08-25
|
5KB
|
193 lines
/* $Revision Header built automatically *************** (do not edit) ************
**
** © Copyright by Thule Software
**
** File : HardCore:Text/Programs/CED/CEDRexx/Spell.ced
** Created on : Torsdag, 03.08.95 14:01:26
** Created by : Nils Peter Sudmann
** Current revision : V1.3
**
**
** Purpose
** -------
** ARexx program to spellcheck current CED file.
** Needs ispell and rexxreqtools.library.
**
** Revision V1.3
** --------------
** created on Fredag, 25.08.95 00:33:53 by Nils Peter Sudmann. LogMessage :
** - Revision 1.1 fixed an non-existing bug ;) This is getting
** confusing. Removed the useless fix.
**
** Revision V1.2
** --------------
** created on Fredag, 25.08.95 00:23:42 by Nils Peter Sudmann. LogMessage :
** - Added a check to see if the current view really was
** saved to a file.
**
** Revision V1.1
** --------------
** created on Torsdag, 17.08.95 22:21:47 by Nils Peter Sudmann. LogMessage :
** - Fixed bug when file was stored in a root device. Ie. the
** path ended with a ':' instead of a '/'.
**
** Revision V1.0
** --------------
** created on Torsdag, 03.08.95 14:01:26 by Nils Peter Sudmann. LogMessage :
** --- Initial release ---
**
*********************************************************************************/
ispellcmd = 'run <nil: >nil: ispell -r -pHardCore:users/nilss/.ispell >nil: <nil:'
ispelldeftemp = 'T:'
cr='0A'X
call addlib('rexxreqtools.library',5,-30)
options results
status 19
filename = result
status 21
if result = '' then do
call rtezrequest('Save your view to a file first.','OK','Spell...');
call Quit
exit 0
end
if ~show(ports, 'IRexxSpell') then
do
address command ispellcmd
address command waitforport 'IRexxSpell'
if rc=5 then do
call rtezrequest('Unable to find port IRexxSpell.'cr'Check your paths.'cr||ispellcmd,'OK','Spell...');
call Quit
exit 0
end
end
fname_clip = address() || 'file' || filename
pos_clip = address() || 'pos' || filename
posx_clip = address() || 'x' || filename
posy_clip = address() || 'y' || filename
xx = getclip(posx_clip)
yy = getclip(posy_clip)
errfname = getclip(fname_clip)
pos = getclip(pos_clip)
if errfname == '' then do
pos = 0; xx = 0; yy = 0
address 'IRexxSpell' filecheck filename
errfname = result
if pos('Error', errfname) ~= 0 then do
call rtzrequest('ISpell 'errfname,'OK','Spell...');
call Quit
exit 0
end
split = lastpos('/', errfname )
errfname = ispelldeftemp||substr(errfname, split +1)
pos = 0
call setclip fname_clip, errfname
end
if open('err', errfname,'r') = 0 then do
call rtzrequest('Can''t find '||errfname||'!','OK','Spell...');
call Quit
exit 0
end
seek('err', pos, 'BEGIN')
word = readln('err')
pos = seek('err', 0, 'Current')
call setclip pos_clip, pos
close('err')
if word = "" then do
call Quit
exit 0
end
address 'IRexxSpell' check word
parse var result type' 'word' '.' 'choices
jumpto yy+1 xx+1
search for... word 0 0 1 1
if (result = 0) then do
call rtezrequest('Failed search for "'||word||'"!'||cr||'You have probably modified the file.'||cr||'Please save and try again.','OK','Spell...')
call Quit
exit 0
end
status 46
setclip(posx_clip,result)
status 47
setclip(posy_clip,result)
if choices = '' then do
res = rtezrequest('No suggestion for "'word||'".','OK|_Options|_Cancel','Spell...')
if (res=2) then
call Options
exit 0
end
else do
cc = 0
rest = choices
do while (rest ~= '')
cc = cc + 1
parse var rest c.cc', 'rest
end
dcc = 1
do forever
btext = 'Misspelled word: "'||word||'" (with '||cc||' suggestions).'||cr
gad = 'More..'
do i=dcc for Min(dcc+4, cc)-dcc+1
btext = btext||cr||i||': '||c.i
gad = gad||'|_'||i
end
res = rtezrequest(btext,gad||'|_Options|_Cancel','Suggestions...')
if (res = i+2-dcc) then
call Options
else do
if (res = 1) then do
if (dcc+5 > cc) then
dcc = 1
else
dcc = dcc+5
end
end
if (res ~= 1) then break
end
cc = res+dcc-2
select
when (res < 2) then
nop
when (res < i+2-dcc) then do
/* 'delete word'
Text c.cc*/
LEFT
replace word '"'c.cc'"'
end
otherwise
nop
end
end
exit 0
end
Options:
res2 = rtezrequest('Misspelled word: "'||word||'".'||cr||'What should I do?',"Accept|_Add|_Quit|_Cancel",'Options...')
select
when (res2 = 1) then
address 'IRexxSpell' ACCEPT word
when (res2 = 2) then
address 'IRexxSpell' ADD word
when (res2 = 3) then
call Quit
when (res2 = 0) then
res = 1
end
return
Quit:
call rtezrequest('No more misspellings were found!','OK','Spell...')
address command 'delete >nil: '||errfname
setclip(pos_clip)
setclip(posx_clip)
setclip(posy_clip)
setclip(fname_clip)
return